﻿
CREATE TRIGGER [dbo].[triu_StateFlow_Groups]
ON [dbo].[t_StateFlow_Groups]
FOR INSERT,UPDATE
AS

IF NOT UPDATE(principal_id) RETURN

UPDATE    t_StateFlow_Groups
SET              principal_name = P.NameSpace
FROM         t_StateFlow_Groups AS i INNER JOIN
                      dbo.fs_Principals() AS P ON i.principal_id = P.principal_id INNER JOIN
                      t_StateFlow_Groups ON i.ID = t_StateFlow_Groups.ID

